<script lang="ts" setup>
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const emit = defineEmits(["refresh"]);
const config = reactive({
  messageText: t("shua-xing-cheng-gong"),
  loading: false,
});
/**刷新成功 */
function success() {
  config.messageText = t("shua-xing-cheng-gong");
  config.loading = false;
}
/**刷新失败 */
function fail() {
  config.messageText = t("shua-xing-shi-bai");
  config.loading = false;
}
/**开始刷新 */
function start() {
  config.loading = true;
}
defineExpose({ ...config, start, fail, success });
</script>
<template>
  <van-pull-refresh
    class="PullRefresh"
    :modelValue="config.loading"
    :success-text="config.messageText"
    @refresh="emit('refresh')"
    ><slot></slot>
  </van-pull-refresh>
</template>

<style lang="less" scoped></style>
